play <- function() {
  get_symbols <- function() {
    wheel <- c("DD", "7", "BBB", "BB", "B", "C", "0")
    sample(wheel, size = 3, replace = TRUE, prob = c(0.03, 0.03, 0.06, 0.1, 0.25, 0.01, 0.4))
  }

  symbols <- get_symbols()
  print(symbols)

  same <- all(symbols == symbols[1])
  bar <- all(symbols %in% c("B", "BB", "BBB"))
  symbols <- c("C", "DD", "DD")

  if (same) {
    # 找到对应的中奖金额
    payout <- c("D" = 100, "7" = 80, "BBB" = 40, "BB" = 25, "B" = 10, "C" = 10)
    prize <- unname(payout[symbols[1]])
  } else if (bar) {
    prize <- 5
  } else {
    # 计算樱桃的数量
    cherry <- sum(symbols == "C")
    prize <- c(0, 2, 5)[cherry + 1]
  }

  # 计算钻石的数量
  diamond <- sum(symbols == "DD")
  prize <- prize + (2 * diamond)

  print(prize)
}
play()
